<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- 
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License. 
-->
<html>
<head>
    <link type="text/css" rel="stylesheet" href="https://struts.apache.org/css/default.css">
    <style type="text/css">
        .dp-highlighter {
            width:95% !important;
        }
    </style>
    <style type="text/css">
        .footer {
            background-image:      url('https://cwiki.apache.org/confluence/images/border/border_bottom.gif');
            background-repeat:     repeat-x;
            background-position:   left top;
            padding-top:           4px;
            color:                 #666;
        }
    </style>
    <script type="text/javascript" language="javascript">
        var hide = null;
        var show = null;
        var children = null;

        function init() {
            /* Search form initialization */
            var form = document.forms['search'];
            if (form != null) {
                form.elements['domains'].value = location.hostname;
                form.elements['sitesearch'].value = location.hostname;
            }

            /* Children initialization */
            hide = document.getElementById('hide');
            show = document.getElementById('show');
            children = document.all != null ?
                    document.all['children'] :
                    document.getElementById('children');
            if (children != null) {
                children.style.display = 'none';
                show.style.display = 'inline';
                hide.style.display = 'none';
            }
        }

        function showChildren() {
            children.style.display = 'block';
            show.style.display = 'none';
            hide.style.display = 'inline';
        }

        function hideChildren() {
            children.style.display = 'none';
            show.style.display = 'inline';
            hide.style.display = 'none';
        }
    </script>
    <title>WebLogic 6.1</title>
</head>
<body onload="init()">
<table border="0" cellpadding="2" cellspacing="0" width="100%">
    <tr class="topBar">
        <td align="left" valign="middle" class="topBarDiv" align="left" nowrap>
            &nbsp;<a href="home.html">Home</a>&nbsp;&gt;&nbsp;<a href="guides.html">Guides</a>&nbsp;&gt;&nbsp;<a href="core-developers-guide.html">Core Developers Guide</a>&nbsp;&gt;&nbsp;<a href="application-servers.html">Application Servers</a>&nbsp;&gt;&nbsp;<a href="weblogic-61.html">WebLogic 6.1</a>
        </td>
        <td align="right" valign="middle" nowrap>
            <form name="search" action="https://www.google.com/search" method="get">
                <input type="hidden" name="ie" value="UTF-8" />
                <input type="hidden" name="oe" value="UTF-8" />
                <input type="hidden" name="domains" value="" />
                <input type="hidden" name="sitesearch" value="" />
                <input type="text" name="q" maxlength="255" value="" />
                <input type="submit" name="btnG" value="Google Search" />
            </form>
        </td>
    </tr>
</table>

<div id="PageContent">
    <div class="pageheader" style="padding: 6px 0px 0px 0px;">
        <!-- We'll enable this once we figure out how to access (and save) the logo resource -->
        <!--img src="/wiki/images/confluence_logo.gif" style="float: left; margin: 4px 4px 4px 10px;" border="0"-->
        <div style="margin: 0px 10px 0px 10px" class="smalltext">Apache Struts 2 Documentation</div>
        <div style="margin: 0px 10px 8px 10px"  class="pagetitle">WebLogic 6.1</div>

        <div class="greynavbar" align="right" style="padding: 2px 10px; margin: 0px;">
            <a href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=14216">
                <img src="https://cwiki.apache.org/confluence/images/icons/notep_16.gif"
                     height="16" width="16" border="0" align="absmiddle" title="Edit Page"></a>
            <a href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=14216">Edit Page</a>
            &nbsp;
            <a href="https://cwiki.apache.org/confluence/pages/listpages.action?key=WW">
                <img src="https://cwiki.apache.org/confluence/images/icons/browse_space.gif"
                     height="16" width="16" border="0" align="absmiddle" title="Browse Space"></a>
            <a href="https://cwiki.apache.org/confluence/pages/listpages.action?key=WW">Browse Space</a>
            &nbsp;
            <a href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=WW&fromPageId=14216">
                <img src="https://cwiki.apache.org/confluence/images/icons/add_page_16.gif"
                     height="16" width="16" border="0" align="absmiddle" title="Add Page"></a>
            <a href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=WW&fromPageId=14216">Add Page</a>
            &nbsp;
            <a href="https://cwiki.apache.org/confluence/pages/createblogpost.action?spaceKey=WW&fromPageId=14216">
                <img src="https://cwiki.apache.org/confluence/images/icons/add_blogentry_16.gif"
                     height="16" width="16" border="0" align="absmiddle" title="Add News"></a>
            <a href="https://cwiki.apache.org/confluence/pages/createblogpost.action?spaceKey=WW&fromPageId=14216">Add News</a>
        </div>
    </div>

    <div class="pagecontent">
        <div class="wiki-content">
            <div id="ConfluenceContent">

<h1 id="WebLogic6.1-RunningonWeblogicServer6.1">Running on Weblogic Server 6.1</h1>

<p>This document describes why the framework doesn't work "as-is" on Weblogic Server 6.1 and shows how to build an additional JAR that will fix the problems.</p>

<p><img class="emoticon emoticon-information" src="https://cwiki.apache.org/confluence/s/en_GB/5982/f2b47fb3d636c8bc9fd0b11c0ec6d0ae18646be7.1/_/images/icons/emoticons/information.png" data-emoticon-name="information" alt="(info)"> The service pack SP4 of Weblogic Server 6.1 was used to test these notes.</p>

<p>The first part of this document describes the technical problems and the theoretical solution.</p>

<h2 id="WebLogic6.1-WhyItDoesn'tJustWork">Why It Doesn't Just Work</h2>

<p>Weblogic 6.1 was published just prior to the finalization of the Servlet 2.3 specification. The incompatibility is that servlet filters and listeners in Weblogic 6.1 do not work with the 2.3 spec primarily because the servlet context is not retrieved in the same way.  This causes virtually all filter initialization operations to fail with an AbstractMethodError exception.</p>

<h2 id="WebLogic6.1-HowtheFrameworkisModified">How the Framework is Modified</h2>

<p>In Servlet 2.3, the servlet context is available from the session object; this is not true for Weblogic Server 6.1. Hence, filters and listeners must be modified to retrieve the servlet context from a different source; this is accomplished by retrieving the servlet context from the FilterConfig passed to the servlet filters during initialzation.</p>

<p>However, the framework code cannot be modifed to do this, because this will break the Servlet 2.3 specification.  The goal is to leave the "original" framework unmodified so that it is still Servlet 2.3 compatible, and then to add an additional JAR that "breaks" the frame to work on Weblogic Server 6.1.</p>

<p>The framework has already been modified slightly to make the above effort possible:</p>
<ol><li><strong>RequestLifecycleFilter</strong> is modified to retrieve its servlet context from the method <code>getServletContext</code>. This method, <code>getServletContext</code>, is then implemented to return the servlet context from where it is available in Servlet 2.3: the session object. The logical operation is unchanged, but now subclasses can override <code>getServletContext</code> to retrieve the servlet context from a different location as we'll see below.</li></ol>


<ol><li><strong>SessionLifecycleListener</strong> is modified in the same way as RequestLifecycleFilter. The method, <code>getServletContext</code>, is implemented to return the servlet context, in this case also from the session object. Again, subclasses can override the <code>getServletContext</code> method to restore the servlet context from a different source. Again, this class's functionality is unchanged.</li></ol>


<p>Now, in a separate project, the following classes are added and compiled into a separate JAR:</p>

<h3 id="WebLogic6.1-RequestLifecycleFilterCompatWeblogic61">RequestLifecycleFilterCompatWeblogic61</h3>

<p>This subclass of RequestLifecycleFilter simply overrides getServletContext() to retrieve the servlet context from the filter config, creates a singleton class, SessionContextSingleton, and assigns the servlet context to the singleton so that the listeners will have the ability to retrieve it.</p>

<h3 id="WebLogic6.1-SessionLifecycleListenerCompatWeblogic61">SessionLifecycleListenerCompatWeblogic61</h3>

<p>This subclass of SessionLifecycleListener simply overrides getServletContext() to retrieve the servlet context from the singleton created above.</p>

<h3 id="WebLogic6.1-FilterDispatcherCompatWeblogic61">FilterDispatcherCompatWeblogic61</h3>

<p>Although the superclass of this class, FilterDispatcher, is commented out, this subclass retrieves the servlet context in the same way as RequestLifecycleFilterCompatWeblogic61 in case it is ever resurrected. At this time, this class is unnecessary.</p>

<h3 id="WebLogic6.1-ServletContextSingleton">ServletContextSingleton</h3>

<p>A singleton class whose sole purpose is to hold the servlet context so that listener classes have access to it.</p>

<h2 id="WebLogic6.1-SettingUptoRunonWeblogic6.1">Setting Up to Run on Weblogic 6.1</h2>


<h3 id="WebLogic6.1-Buildingyourownproject">Building your own project</h3>

<p>In the {{web.xml} file, make the following class name substitutions:</p>
<div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p> Old Class Name </p></th><th colspan="1" rowspan="1" class="confluenceTh"><p> New Class Name </p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> RequestLifecycleFilter </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> RequestLifecycleFilterCompatWeblogic61 </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> SessionLifecycleListener </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> SessionLifecycleListenerCompatWeblogic61 </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> FilterDispatcher </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> FilterDispatcherCompatWeblogic61 </p></td></tr></tbody></table></div>


<h2 id="WebLogic6.1-FAQ">FAQ</h2>


<h3 id="WebLogic6.1-IstillgettheAbstractMethodErrorExceptionwhenWeblogicServerstartsup.WhatamIdoingwrong?">I still get the AbstractMethodError Exception when Weblogic Server starts up.  What am I doing wrong?</h3>

<ol><li>Check to see if a <code>action2-example.war</code> is still lingering in your <code>mydomain/applications</code> folder and delete it if it is there.</li><li>See next FAQ question.</li></ol>


<h3 id="WebLogic6.1-Theserverbehaviorseemslikeitisfromaprevioussourcecodebase;Ican'tdebugit.What'stheclue?">The server behavior seems like it is from a previous source code base; I can't debug it.  What's the clue?</h3>

<p>Sometimes BEA Weblogic Server doesn't "rebuild" its temporary files.  Do the following to force the temporary files to rebuild:</p>
<ol><li>Stop the server.</li><li>Delete the .wlnotdelete folder in <code>mydomain/applications</code>.</li><li>Restart the server.</li></ol></div>
        </div>

        
    </div>
</div>
<div class="footer">
    Generated by CXF SiteExporter
</div>
</body>
</html>
